package cn.vc.shop.controller;

import cn.vc.auth.entity.po.VUser;
import cn.vc.basicmodule.entity.Result;
import cn.vc.shop.service.CommodityActService;
import cn.vc.shop.util.SecurityUtil;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/commodity_act")
public class CommodityActController {

    @Autowired
    private CommodityActService commodityActService;
    @Autowired
    private RedisTemplate redisTemplate;



    /**
     * 收藏商品
     * @param token
     * @param commodityId
     * @return
     */
    @PostMapping("/1")
    public Result<?> follow(@RequestHeader(value = "token") String token,
                            @RequestParam("id") Long commodityId) {
        VUser myUser = SecurityUtil.getUser();
        if (myUser==null) return Result.NOT_LOGGED_IN();
        return null;
    }
    /**
     * 评分及评论商品
     * @param token
     * @param commodityId
     * @param mark
     * @param comment
     * @return
     */
    @PostMapping("/2")
    public Result<?> comment(@RequestHeader(value = "token") String token,
                             @RequestParam("id") Long commodityId, Integer mark,
                             @RequestBody String comment) {
        VUser myUser = SecurityUtil.getUser();
        if (myUser==null) return Result.NOT_LOGGED_IN();
        return null;
    }
}
